package com.ftg.learn.exam.sys.service.imple;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ftg.learn.exam.sys.entity.SysRole;
import com.ftg.learn.exam.sys.mapper.SysRolePlus;
import com.ftg.learn.exam.sys.service.SySRolePlus;
import com.ftg.learn.exam.util.QueryRuestType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author KangJx
 * @date 2021/4/29
 */
@Service
public class SysRolePlusImple implements SySRolePlus {

    @Autowired
    SysRolePlus sys;

    public List<SysRole> showpage(){
        QueryWrapper<SysRole> query = new QueryWrapper<>();
        query.like("role_name","A");
        return sys.selectList(query);
    }

    public IPage<SysRole> page(int page ,int limit){
        QueryWrapper<SysRole> query = new QueryWrapper<>();
        query.like("role_name","A");
        IPage<SysRole> ip = new Page<>(page,limit);

        return sys.selectPage(ip,null);
    }

    public QueryRuestType<SysRole> page1(int page , int limit){

        IPage ip = new Page<>(page,limit);
        ip = sys.selectPage(ip,null);

        return new QueryRuestType<SysRole>(ip);
    }


}
